
#pragma once
#include <cmath>
#include <list>
#include <set>
#include "../common/ProblemsContainerBase.h"

namespace LGFun
{

/*
LEGEND SAYS:
The little Gauss was studing in the primary school when the teacher, to get rid of the children
for an hour, gave them this task: "Add all the numbers from one to one hundred!"
All the children began: 1 + 2 + 3 + 4 ...
The little Gauss no!
He began with the first and last number:
1 + 100 = 101
2 +99 = 101
And knew immediately that it could do so up to 50 + 51 = 101.
Number required is therefore 50 times 101, because 100 times 101 is 10100,
the required result is 5050.
He had discovered the arithmetic progressions still teach so... whith disappointment of the theacher.
*/
    inline UInt32 GaussSerieSum(UInt32 i_maxNum)
    {
        UInt32 ret = i_maxNum;
        ret *= (i_maxNum + 1);
        ret = ret >> 1;

        return ret;
    }

    inline UInt32 SquareSerieSum(UInt32 i_maxNum)
    {
        UInt32 ret = i_maxNum;
        ret *= (i_maxNum+1);
        ret *= ((2 * i_maxNum) + 1);
        ret /= 6;
        
        return ret;
    }
}
